/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainMenu.java
 *
 * Created on Nov 21, 2011, 11:40:43 AM
 */
package view;

import main.WinkelApplication;
import model.Auth;

/**
 *
 * @author 
 * Bart de Man * 
 * ________              _____     _________          ______  ___              
 * ___  __ )_____ _________  /_    ______  /____      ___   |/  /_____ _______ 
 * __  __  |  __ `/_  ___/  __/    _  __  /_  _ \     __  /|_/ /_  __ `/_  __ \
 * _  /_/ // /_/ /_  /   / /_      / /_/ / /  __/     _  /  / / / /_/ /_  / / /
 * /_____/ \__,_/ /_/    \__/      \__,_/  \___/      /_/  /_/  \__,_/ /_/ /_/ 
 * 
 */
public class MainMenu extends javax.swing.JPanel {

    /** Creates new form MainMenu */
    public MainMenu() {
        initComponents();
        
        //change visible buttons according to logged in user
        //Legend: 0 - not logged in. 1 - admin, 2- employee, 3 - manager (no hiding required for 3)
        if(WinkelApplication.getInstance().getRoleID() == 2){
            jButton4.setVisible(false); //Rapporten
            jButton6.setVisible(false); //Producten    
            jButton7.setVisible(false); //Categorie    
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        orderButton = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();

        jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
        add(jPanel1);

        jButton1.setText("Catalogus");
        jButton1.setMaximumSize(new java.awt.Dimension(150, 100));
        jButton1.setPreferredSize(new java.awt.Dimension(150, 100));
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        add(jButton1);

        jButton2.setText("Klanten");
        jButton2.setPreferredSize(new java.awt.Dimension(150, 100));
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        add(jButton2);

        jButton4.setText("Rapporten");
        jButton4.setMaximumSize(new java.awt.Dimension(150, 100));
        jButton4.setPreferredSize(new java.awt.Dimension(150, 100));
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        add(jButton4);

        jButton6.setText("Producten");
        jButton6.setMaximumSize(new java.awt.Dimension(150, 100));
        jButton6.setPreferredSize(new java.awt.Dimension(150, 100));
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });
        add(jButton6);

        orderButton.setText("Orders");
        orderButton.setMaximumSize(new java.awt.Dimension(150, 100));
        orderButton.setPreferredSize(new java.awt.Dimension(150, 100));
        orderButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                orderButtonActionPerformed(evt);
            }
        });
        add(orderButton);

        jButton7.setText("Categorieën");
        jButton7.setPreferredSize(new java.awt.Dimension(150, 100));
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });
        add(jButton7);

        jButton5.setLabel("Log uit");
        jButton5.setMaximumSize(new java.awt.Dimension(150, 100));
        jButton5.setMinimumSize(new java.awt.Dimension(83, 23));
        jButton5.setPreferredSize(new java.awt.Dimension(150, 100));
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        add(jButton5);
    }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    WinkelApplication.getInstance().showPanel(new CategoryList());
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    Auth auth = new Auth();
    auth.logOff();
}//GEN-LAST:event_jButton5ActionPerformed

private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed
    WinkelApplication.getInstance().showPanel(new orderList());
}//GEN-LAST:event_orderButtonActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        WinkelApplication.getInstance().showPanel(new Producten());
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        WinkelApplication.getInstance().showPanel(new Category());
    }//GEN-LAST:event_jButton7ActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        WinkelApplication.getInstance().showPanel(new Rapporten());
}//GEN-LAST:event_jButton4ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        WinkelApplication.getInstance().showPanel(new CustomerList());
    }//GEN-LAST:event_jButton2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton orderButton;
    // End of variables declaration//GEN-END:variables
}